package com.bw.router

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.bw.base.constants.RoutePath

/**
 * 定义全局页面跳转降级策略
 */

@Route(path = RoutePath.PATH_GLOBAL_DEGRADE)
class GlobalDegradeService:DegradeService {

    private lateinit var mContext:Context

    override fun init(context: Context?) {
        if(context!=null){
            mContext = context
        }
    }

    /**
     * 跳转到空页面
     */
    override fun onLost(context: Context?, postcard: Postcard?) {
        postcard?.group = RoutePath.GROUP_EMPTY
        postcard?.path = RoutePath.PATH_EMPTY
        postcard?.navigation()
    }
}